// app/layout.js
'use client';

import Link from 'next/link';
import { usePathname } from 'next/navigation';
import {menus} from "../menu";
import {ToastContainer} from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
export default function Layout({ children }) {
    const pathname = usePathname();

    return (
        <div className="grid grid-cols-6 h-screen bg-gray-100  gap-1">
            <aside className="col-span-1 bg-white border-r border-gray-200">
                <div className="p-4 space-y-4">
                    <h1 className="text-2xl font-bold text-gray-800">欢迎来到首页</h1>
                    <ul className="space-y-2">
                        {menus.map((menu) => (
                            <li key={menu.id}>
                                <Link
                                    href={menu.path}
                                    className="block px-4 py-2 text-gray-700 rounded-lg hover:bg-gray-100"
                                >
                                    {menu.name}
                                </Link>
                            </li>
                        ))}
                    </ul>
                </div>
            </aside>
            <main className="col-span-5">
                {children}
            </main>
          <ToastContainer/>
        </div>
    );
}